﻿@{
    Layout = "_Layout.cshtml";
}
@using WebApp.Models
@using WebApp.Extensions
@using Telerik.Web.Mvc.UI
@model IEnumerable<ENT_Centro>
@{
    ViewBag.Title = "Lista dei centri di produzione";
    String stm = (String)ViewData["stm"];
}
@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .ToolBar(commands => { 
            commands.Insert();
            commands.Custom().Action("STA_LST", "Setup", new { }).Text("Stampante");
            })
        .DataKeys(keys => keys.Add(c => c.Guid))
        .HtmlAttributes(new { @class = "data" })
        .Columns(columns =>
        {
            columns.Bound(o => o.Nome).Sortable(true).Title("Nome");
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
                commands.Delete().ButtonType(GridButtonType.Image);
            }).Width(100);
        })
        .Editable(editing => editing.Mode(GridEditMode.PopUp))
        .DataBinding(dataBinding => dataBinding
            .Server()
               .Select("STA_CEN_LST", "Setup", new { f0 = stm })
               .Insert("STA_CEN_INS", "Setup", new { f0 = stm })
               .Update("STA_CEN_SAV", "Setup", new { f0 = stm })
               .Delete("STA_CEN_DEL", "Setup", new { f0 = stm }))

)